import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserRepurchaseVO, UserRepurchaseForm, UserRepurchaseQuery } from '@/api/business/userRepurchase/types';

/**
 * 查询用户充值复购u记录列表
 * @param query
 * @returns {*}
 */

export const listUserRepurchase = (query?: UserRepurchaseQuery): AxiosPromise<UserRepurchaseVO[]> => {
  return request({
    url: '/business/userRepurchase/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户充值复购u记录详细
 * @param id
 */
export const getUserRepurchase = (id: string | number): AxiosPromise<UserRepurchaseVO> => {
  return request({
    url: '/business/userRepurchase/' + id,
    method: 'get'
  });
};

/**
 * 新增用户充值复购u记录
 * @param data
 */
export const addUserRepurchase = (data: UserRepurchaseForm) => {
  return request({
    url: '/business/userRepurchase',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户充值复购u记录
 * @param data
 */
export const updateUserRepurchase = (data: UserRepurchaseForm) => {
  return request({
    url: '/business/userRepurchase',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户充值复购u记录
 * @param id
 */
export const delUserRepurchase = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/userRepurchase/' + id,
    method: 'delete'
  });
};
